<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
	<title></title>
</head>
<body>
    <script type="text/javascript">
        var firstname;
        firstname="Jim";
        document.write(firstname);
        document.write("<br />");
        // change the value of variable
        firstname="Tove";
        document.write(firstname);
    </script>
	
    <br />
    <script type="text/javascript">
        var x=5;
        carname="Volvo";
        z=x+7;
        document.write(z);
        document.write("<br />");
        document.write(++z);
        document.write("<br />");
        document.write(z++);
        document.write("<br />");
        document.write(z);
        document.write("<br />");
        document.write(carname + " number =" + x);
    </script>
    <br />
    <p>javascript comparison </p>
    <script type="text/javascript">
        var y=5;
        // is equal to
        document.write(y==5);
        document.write("<br />");
        // is exactly equal to (value and type)
        document.write(y==="5");
        document.write("<br />");
        // is not equal
        document.write(y!=5);
        document.write("<br />");
        // is greater than
        document.write(y>3);
        document.write("<br />");
        document.write(y>9);
        document.write("<br />");
        // is less than
        document.write(y<6);
        document.write("<br />");
        // is greater than or equal to
        document.write(y>=5);
        document.write("<br />");
        // is less than or equal to
        document.write(y<=4);
        document.write("<br />");
    </script>
    <p>    logical operator</p>
    <script type="text/javascript">
        x=6;
        y=4;
if (x<10 && y>3)
    document.write("yes!");
    document.write("<br /> done");
    </script>
    <hr />
    <p>    if else statements</p>
    <script type="text/javascript">
    //write a "good morning" greeting if
    //the time is less than 10
    var d=new Date();
    var time=d.getSeconds();
    document.write(time + "<br />");
    if (time<20) {
        document.write("<b>Good morning, second is less than 20</b>");
    }
    else if (time>=20 && time <40) {
        document.write("The second is greater than 20 and less than 40");
    }
    else {
        document.write("The second is greater than or equal to 40");
    }
    </script>

    <hr />
    <p>    switch statement</p>
    <script type="text/javascript">
        var da=new Date();
        var date=da.getDate();
        document.write(date + "<br />");
        var day=da.getDay();
        document.write(day + "<br />");
        switch (day) {
            case 6:
                document.write("Saturday");
                break;
            case 5:
                document.write("Friday");
                break;
            case 0:
                document.write("Sunday");
                break;
            default:
                document.write("borning work day");
        }
    </script>

</body>
</html>
